//
//  FFTradeSystemNotifyContent.m
//  LLWallet
//
//  Created by tt on 2020/9/23.
//

#import "FFTradeSystemNotifyContent.h"

@implementation FFTradeSystemNotifyContent


- (void)decodeWithJSON:(NSDictionary *)data {
    NSDictionary *contentDict;
    NSString *content =  data[@"content"];
    if(content && ![content isEqualToString:@""]) {
        NSError *error;
         contentDict = [NSJSONSerialization JSONObjectWithData:[content dataUsingEncoding:NSUTF8StringEncoding] options:kNilOptions error:&error];
        if(error) {
            WKLogError(@"解码交易系统消息的content数据失败！->%@",error);
            return;
        }
    }else{
        contentDict = data;
    }
    
    if(contentDict[@"attrs"] && [contentDict[@"attrs"] isKindOfClass:[NSDictionary class]]) {
        self.attrs = contentDict[@"attrs"];
    }else {
        self.attrs = [NSDictionary dictionary];
    }
    self.centerTitle = contentDict[@"center_title"]?:@"";
    self.centerSubtitle = contentDict[@"center_subtitle"]?:@"";
    self.leftTitle = contentDict[@"left_title"]?:@"";
    self.leftSubtitle = contentDict[@"left_subtitle"]?:@"";
    self.urlTitle = contentDict[@"url_title"]?:@"";
    self.notice = contentDict[@"notice"]?:@"";
   // self.tradeNo = contentDict[@"imprest_code"]?[contentDict[@"imprest_code"] stringValue]:@"";
  
}


+ (NSNumber *)contentType {
    return @(WK_TRADE_SYSTEM_NOTIFY);
}

- (NSString *)conversationDigest {
    return self.notice;
}

- (NSString *)searchableWord {
    return self.notice;
}

@end
